﻿use employees
go
------------------8----------------------------------------------------------------
SELECT DISTINCT 
[Empl].[LastName], 
[Empl].[FirstName] 
FROM [dbo].[Empl],[dbo].[Empl] [E2]
WHERE [Empl].[ID]<>[E2].[ID] AND [Empl].[LastName]=[E2].[LastName] 
ORDER BY [Empl].[LastName],[Empl].[FirstName]

SELECT DISTINCT 
[Empl].[LastName], 
[Empl].[FirstName]
FROM [dbo].[Empl]
WHERE ([Empl].[LastName] IN (SELECT 
[Empl].[LastName]  
FROM [dbo].[Empl]
GROUP BY [Empl].[LastName]  
HAVING Count([Empl].[LastName])>=2))
ORDER BY [Empl].[LastName], [Empl].[FirstName]


